package com.example.controller;

import com.example.impl.ProviderServiceImpl;
import com.example.details.ProviderTestDTO;
//import com.example.service.TestService;
//import com.example.service.TestService;
import com.example.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ：songxusheng
 * @date ：Created in 2022/4/7 15:08
 * @description：测试控制层
 * @version: $
 */
@RestController
@RequestMapping("/test")
public class TestController {
    @Resource
    private ProviderServiceImpl providerService;
    @Autowired
    private TestService testService;

    @RequestMapping("/find")
    public String find(){
        String name="张三";
        return testService.call(name);
    }

    @RequestMapping("get")
    public List<ProviderTestDTO> query(){
        return providerService.test();
    }

    @PostMapping("testUpload")
    public void upload(@RequestParam("file") MultipartFile file){
        System.out.println(file.getOriginalFilename());
        providerService.upload(file);
    }
}
